package com.soa.demo;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Description:
 * @Author: Jukomu
 * @Package: com.soa.demo
 * @Project: APIService
 * @name: SwaggerConfig
 * @Date: 2024/12/12-11:16
 * @Filename: SwaggerConfig
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        ApiInfo apiInfo = (new ApiInfoBuilder()).title("SOA_test").description("SOA实验API文档......").version("1.0").contact(new Contact("\u590F\u4E0E", "", "853172836@qq.com")).license("The Apache License").licenseUrl("http://www.baidu.com").build();
        return (new Docket(DocumentationType.SWAGGER_2))
                .pathMapping("/")
                .select()

                .apis(RequestHandlerSelectors.basePackage("com.soa.demo"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo);
    }
}
